package org.nado.restaurant;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;


public interface RestaurantDAO {

	@Insert("INSERT INTO TBL_RESTAURANT	(rest_id, rest_name, rest_addr, rest_phone, rest_mapx, rest_mapy, rest_link) VALUES ( 'rest'||(LPAD(TO_CHAR(seq_restaurant.NEXTVAL),6,'0')), #{rest_name}, #{rest_addr}, #{rest_phone}, #{rest_mapx}, #{rest_mapy}, #{rest_link})")
	public abstract void create(RestaurantVO vo) throws Exception;
	
	@Select("SELECT rest_id, rest_name, rest_addr, rest_phone, rest_mapx, rest_mapy, rest_link, rest_cnt FROM TBL_RESTAURANT WHERE rest_id = #{rest_id}")
	public RestaurantVO read(String rest_id) throws Exception;

	public abstract void update(RestaurantVO vo) throws Exception;

	
	
//	@Insert("INSERT INTO TBL_RESTAURANT_MENU(rest_id, menu_id) VALUES ('rest'||(LPAD(TO_CHAR(#{rest_id}),6,'0')), 'menu'||(LPAD(TO_CHAR(#{menu_id}),3,'0')))")
	@Insert("INSERT INTO TBL_RESTAURANT_MENU (REST_ID, MENU_ID) VALUES (#{rest_id},#{menu_id})")
	public abstract void createRM(RestaurantVO vo)throws Exception;
	
	@Select("SELECT rest_id, menu_id FROM TBL_RESTAURANT_MENU WHERE menu_id = #{menu_id}")
	public abstract List<RestaurantVO> readRM(String menu_id) throws Exception;
	
	
	@Delete("delete from tbl_restaurant_menu where rest_id = #{rest_id}")
	public abstract void delete(String rest_id) throws Exception;


}